<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/approveOrder.do"/>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.SessionKeys,
                 com.scalar.chiptrack.commons.Constants,
                 java.util.ArrayList,
                 com.scalar.chiptrack.sales.LineItem,
                 com.scalar.chiptrack.sales.SalesOrder,
                 com.scalar.chiptrack.sales.forms.ApproverOrderForm,
                 org.apache.struts.util.LabelValueBean,
                 java.util.HashMap"%>
<%@ page import="com.scalar.chiptrack.users.Functionality"%>
<%@ page import="com.scalar.chiptrack.users.User"%>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<% try { %>

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR>

<script type="text/javascript">

// Added by Gandhi on 30 Nov 2004
function noenter()
 {
   return !(window.event && window.event.keyCode == 13)

 }


</script>


</HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0" >

<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js">
</script>

<SCRIPT language="JavaScript">
var isSample = <%=request.getParameter("isSample")%>;
    //Added by veeru on 29th March 2004
    var dateElement = "";
    // Modified popup window names acc to usage by veeru on 6th April 2004
    function openCalendar(dateValue)
    {
        dateElement = dateValue;

        newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','calenderPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
        newWindow.moveTo(550,180);
        newWindow.focus();
    }

    //Begin: added by Sujan on 19th Nov 2004
    var requestedDt = "";
	function openScheduleCalendar(dateValue, requestedDtValue)
    {
        dateElement = dateValue;
		requestedDt = requestedDtValue;
        newWindow = window.open('<%=chipTracContext%>/jsp/includes/scheduleCalendar.html','scheduleCalendarPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
        newWindow.moveTo(550,180);
        newWindow.focus();
    }
    //End: by sujan

    function assignDate(passedValue)
    {
        dateElement.value=passedValue;
        giveMsg();
        window.focus();
    }

    function openScheduling(partNo, lineItemNo, salesOrderId)
    {
  	newWindow = window.open('scheduling.do?action=ShowInventory&mfgPartNo='+partNo+'&lineItemNo='+lineItemNo+'&salesOrderId='+salesOrderId,'schedulePopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,width=970,height=420,top=140,left=30,resizable=yes');
  	//newWindow.moveTo(30,140);
	newWindow.focus();
    }

    function scheduleLineItem (partNo, lineItemNo, salesOrderId, requestedDate, quantity)
    {
  	newWindow = window.open('scheduling.do?action=reschedule&mfgPartNo='+partNo+'&lineItemNo='+lineItemNo+'&salesOrderId='+salesOrderId+'&requestedDate='+requestedDate+'&quantity='+quantity,'lineItemsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=yes,scrollbars=yes,top=0,left=0,resizable=yes');
	newWindow.focus();
    }

    function openReasonCodes()
    {
        newWindow = window.open('reasonCodes.do?action=Show','reasonCodesPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,top=0,left=0,height=300,widht=500,resizable=yes');
	    newWindow.focus();
    }

//Added by Sarada on 10th Oct 2003 to do validations for scheduleDate
var errors = "";

function dateValidation()
{
	errors = "";
	var dateValue = "";
    var tempDate = document.approverOrderForm["scheduleDate"];

	if( typeof tempDate.length == 'undefined' )
    {
	    if( chkScheduleRevisedDate(tempDate.value.trim(),"Schedule Date","Y") == false)
		{
			errors = errMsg;
			tempDate.select();
			tempDate.focus();
		}
        //else if ( isBeforeToday( tempDate.value.trim(), "Schedule Date" ) ) // added by sujan on 20th nov 2004 as schedule date can not be before today date
        //{
          //  errors = errMsg;
			//tempDate.select();
			//tempDate.focus();
        //}

	}
	else
	{

		for(var i=0; i< tempDate.length; i++)
		{
			if( chkScheduleRevisedDate(tempDate[i].value.trim(),"Schedule Date","Y") == false)
			{
				errors = errMsg;
				tempDate[i].select();
				tempDate[i].focus();
				break ;
			}
            //else if ( isBeforeToday( tempDate[i].value.trim(),"Schedule Date" ) ) // added by sujan on 20th nov 2004 as schedule date can not be before today date
            //{
              //  errors = errMsg;
			    //tempDate[i].select();
			    //tempDate[i].focus();
                //break;
            //}

		}//for

    } //else

    if(errors != '')
		return false;
    else
        return true;
}


    function submitPage(action)
    {
		var errors1 = '';
        if( isSample == 0 )
        {
            giveMsg();
            errors1 = items;
        }
		if( dateValidation() == false )
		{
            errors1 = errors;
        }

		if(errors1 != '')
        {
            var pa=document.getElementById("errors");
            pa.innerHTML = errors1;
			return;
        }

        if(action == 'APPROVE')
            document.approverOrderForm.action.value = "ApproveOrder";
        else if(action == 'REJECT')
            document.approverOrderForm.action.value = "RejectOrder";
			// Sarada added this 30th July 2003 to enable Holds before submit
		    if( document.approverOrderForm.lineItemId.length != null)
			{
			  var cnt= document.approverOrderForm.lineItemId.length
			  for( var j=0;j< cnt ;j++)
			  {
                    document.approverOrderForm.scheduleDate[j].disabled = false; // Added By Basha (09/08/2003)

					document.approverOrderForm.marketingHold[j].disabled = false;
					document.approverOrderForm.financeHold[j].disabled = false;
					document.approverOrderForm.operationsHold[j].disabled = false;
					document.approverOrderForm.salesHold[j].disabled = false;
			  }
            }
            else
            {
                document.approverOrderForm.scheduleDate.disabled = false; // Added By Basha (09/08/2003)

                document.approverOrderForm.marketingHold.disabled = false;
                document.approverOrderForm.financeHold.disabled = false;
				document.approverOrderForm.operationsHold.disabled = false;
				document.approverOrderForm.salesHold.disabled = false;
            }

        document.approverOrderForm.submit();
    }

    function openAuditTrail()
    {
        var temp = eval(document.approverOrderForm["salesOrder.salesOrderNo"]);
        var salesOrderNo = temp.value;
        var salesOrderId = document.approverOrderForm.salesOrderId.value;
        var isSample     = document.approverOrderForm.isSample.value;
        newWindow = window.open('salesAuditTrail.do?salesOrderId='+salesOrderId+'&salesOrderNo='+salesOrderNo+'&isSample='+isSample,'auditTrailPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=600,height=700,left=100,top=50,resizable=yes');
  	//newWindow.moveTo(100,50);
  	newWindow.focus();
    }

// Balaram on July 29, 2003
function showErrorReportPage()
{
    newWindow = window.open ('<%=chipTracContext%>/reportProblem.do','reportProblem','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=750,height=400,resizable=no');
    newWindow.focus();
}

    function setScheduleDate(strLineItemId,strScheduleDate)
    {
        if(document.approverOrderForm.lineItemId.length==null)
        {
            if((!document.approverOrderForm.scheduleDate.disabled))
            {
                document.approverOrderForm.scheduleDate.value = strScheduleDate;
            }
        }
        else
        {
            for(var i=0;i < document.approverOrderForm.lineItemId.length;i++)
            {
                if(document.approverOrderForm.lineItemId[i].value==strLineItemId)
                {

                    if((!document.approverOrderForm.scheduleDate[i].disabled))
                    {

                        document.approverOrderForm.scheduleDate[i].value=strScheduleDate;
                    }
                    break;
                }
            }
        }
    }

    function giveMsg()
    {
        items = "";
        var pa = document.getElementById("errors");
        pa.innerHTML = "&nbsp;";

        if( document.approverOrderForm.lineItemId.length != null )
		{
            var cnt= document.approverOrderForm.lineItemId.length
		    for( var j=0;j< cnt ;j++)
			{
                if(!document.approverOrderForm.scheduleDate[j].disabled)
                {
                    if((document.approverOrderForm.scheduleDate[j].value).trim() == "" && document.approverOrderForm.operationsHold[j].value == "" && document.approverOrderForm.cancelStatus[j].value == 'false')
                    {
                        items = items + (document.approverOrderForm.Line_Item_No[j].value) + ",";
                    }
                }
            }
        }
        else
        {
             if(!document.approverOrderForm.scheduleDate.disabled)
             {
                if((document.approverOrderForm.scheduleDate.value).trim() == "" && document.approverOrderForm.operationsHold.value == "" && document.approverOrderForm.cancelStatus.value == 'false')
                {
                    items = document.approverOrderForm.Line_Item_No.value + ",";
                }
             }
        }
        if(items != "")
        {
            var tmp = "";
            if( isSample == 1 )
            {
                tmp = "Warning : ";
            }
            items ="<li>"+tmp+"Schedule Date is not entered for Line Item(s):&nbsp;" + (items.substring(0,items.length-1)) ;
            pa.innerHTML = items;
        }
    }
    function splitLineItems()
    {
        document.approverOrderForm.action.value='splitLineItems';
        document.approverOrderForm.submit();
    }
</SCRIPT>

<%-- Top Header Start --%>
<%@ include file="/jsp/includes/header.jsp" %>
<%-- Top Header End--%>

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<%-- Side Navigations start --%>
<% String heading = ""; %>

<% if(request.getAttribute("isSample").equals("0")) {
         heading = "Sample Order";
%>
	<%@ include file="/jsp/sales/sample_order_menu.jsp" %>
<% } else {
     heading = "Sales Order";
%>
        <%@ include file="/jsp/sales/sales_order_menu.jsp" %>
<% } %>

<% User user1 = (User) session.getAttribute (SessionKeys.USER_KEY); %>
</TD>
<%-- end of the side navigations --%>
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<html:html>

<%-- from here your body starts --%>
<html:form name="approverOrderForm" action="/approveOrder" method="post" type="com.scalar.chiptrack.sales.forms.SalesOrderForm">

<center><span class="NArialW"><%=heading%> Entry</span></center>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>
    <% ApproverOrderForm approveOrderForm = (ApproverOrderForm) request.getAttribute("approverOrderForm"); %>
   <nested:nest property="salesOrder">
   <table border="0" width="90%" align=right>
    <%boolean showMessage = request.getAttribute("showMessage")!=null&&"true".equalsIgnoreCase((String)request.getAttribute("showMessage"));
        if(showMessage){
    %>
        <tr><td colspan=7 align='left'>
        <font class='NArialS'>
        <font color='blue'><b><%=Constants.NO_MODIFY_RIGHTS %></b>
        </font></font></td></tr>
    <%}%>

     <tr>
       <td width="21%"><font class="NArialL">Sales Order No :</font></td>
       <td width="21%" class="bodytext"><b><nested:write property="salesOrderNo" /></b><nested:hidden property="salesOrderNo"/></td>
       <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL">Customer Name :</font></td>
       <td width="21%" class="bodytext"><nested:write property="customerName" /></td>
       <td width="3%">&nbsp;</td>
     </tr>
     <tr>
       <td width="21%"><font class="NArialL">Customer PO No :</font></td>
       <td width="21%"><font class="bodytext"><nested:write property="customerPO"/></font></td>
       <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL">Contact Person :</font></td>
       <td width="21%"><font class="bodytext"><nested:write property="contactPerson"/></font></td>
       <td width="3%">&nbsp;</td>
     </tr>
     <%--<nested:define id="soNo" property="salesOrderNo"/>
     <tr><td colspan=4><font class="NArialL">Please <chiptrack:attachFile fileGroup="SalesOrder-PO" fileSubGroup="<%=soNo%>" formTitle="Attach Sales PO" linkText="click here" allowAttach="<%=!showMessage%>" allowDelete="<%=!showMessage%>"/> to View and Attach PO</font></td></tr>--%>
     <tr>
       <td width="21%"><font class="NArialL">PO Rev :</font></td>
       <td width="21%"><font class="bodytext"><nested:write  property="poRev"/></font></td>
       <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL">PO Date:</font></td>
       <td width="21%"><font class="bodytext"><nested:write  property="poDate"/></font></td>
       <td width="3%">&nbsp;</td>
     </tr>
     <tr>
       <td width="21%"><font class="NArialL">Phone :</font></td>
       <td width="21%" class="bodytext"><nested:write  property="phoneNumber" /></td>
       <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL">Cell No :</font></td>
       <td width="21%" class="bodytext"><nested:write  property="cellNumber" /></td>
	   <td width="3%">&nbsp;</td>

     </tr>
     <tr>
       <td width="21%"><font class="NArialL">Fax :</font></td>
       <td width="21%" class="bodytext"><nested:write  property="faxNumber" /></td>
       <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL">Email :</font></td>
       <td width="21%" class="bodytext"><nested:write  property="email" /></td>
	   <td width="3%">&nbsp;</td>

     </tr>
	  <tr>
       <td width="21%"><font class="NArialL">Sales Person :</font></td>
       <td width="21%" class="bodytext"><nested:write  property="salesPerson" /></td>
       <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL"><bean:message key="label.sales.salesRep.Name"/> :</font></td>
       <td width="21%" class="bodytext"><nested:write  property="salesRep" /></td>
       <td width="3%">&nbsp;</td>
     </tr>
     <tr>
       <td width="21%"><font class="NArialL"><bean:message key="label.sales.salesOrder.ShippingMethod" /> :</font></td>
       <td width="21%"><font class="bodytext"><nested:write property="shippingMethod" /></font></td>
       <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL">Regional Rep : </font></td>
       <td width="21%" class="bodytext"><nested:write name="salesOrderForm" property="regionalRep" /></td>
       <td width="3%">&nbsp;</td>
     </tr>
   <tr>
       <nested:equal value="-2" property="endCustomerId">
           <td width="21%" class="NArialL">Add New <bean:message key="label.sales.endUser"/> :</td>
           <td width="21%" class="bodytext"><nested:write property="newEndUserName"  /></td>
       </nested:equal>
       <nested:notEqual value="-2" property="endCustomerId">
           <td width="21%"><font class="NArialL"><bean:message key="label.sales.endUser"/> :</font></td>
           <td width="21%" class="bodytext"><nested:write property="endCustomer"  /></td>
       </nested:notEqual>
       <td width="3%">&nbsp;</td>
        <nested:equal value="-2" property="odmId">
            <td width="25%" class="NArialL">Add New <bean:message key="label.sales.shipToCustomer"/></td>
            <td width="21%" class="bodytext"><nested:write property="newEndCustomerName" /></td>
        </nested:equal>
        <nested:notEqual value="-2" property="odmId">
            <td width="25%"><font class="NArialL"><bean:message key="label.sales.shipToCustomer"/></font></td>
            <td width="21%" class="bodytext"><nested:write property="odm" /></td>
        </nested:notEqual>
       <td width="3%">&nbsp;</td>
     </tr>
    <tr>
        <td width="21%"><font class="NArialL">Booking Date :</font></td>
        <td width='21%' class="bodytext"><nested:write name="salesOrderForm" property="salesOrderDate"/></td>
        <td width="3%">&nbsp;</td>
        <td width="25%"><font class="NArialL">Quotation No :</font></td>
        <td width="21%" class="bodytext">
            <nested:notEqual value="null" name="salesOrderForm" property="quotationNo">
                <nested:write name="salesOrderForm" property="quotationNo" />
            </nested:notEqual>
        </td>
        <td width="3%">&nbsp;</td>
     </tr>
    <tr>
        <td width="21%"><font class="NArialL">&nbsp;</font></td>
        <td width="21%">&nbsp;</td>
        <td width="3%">&nbsp;</td>
        <nested:equal value="true" name="salesOrderForm" property="isConsignee">
        <td width="25%" class="NArialL">Invoice to Customer : </td>
            <td width="21%" class="bodytext">
                <nested:equal value="0" name="salesOrderForm" property="isConsignmentSales">No</nested:equal>
                <nested:notEqual value="0" name="salesOrderForm" property="isConsignmentSales">Yes</nested:notEqual>
            </td>
        </nested:equal>
        <nested:notEqual value="true" name="salesOrderForm" property="isConsignee">
            <td width="25%">&nbsp;</td>
            <td width="21%">&nbsp;</td>
        </nested:notEqual>
        <td width="3%">&nbsp;</td>
    </tr>
    <tr>
       <td width="21%"><font class="NArialL">Pay Terms :</font></td>
       <td width="21%" class="bodytext">
        <nested:notEqual name="salesOrderForm" property="shippingTerms" value="-1" >
            <nested:write name="salesOrderForm" property="shippingTerms"  />
        </nested:notEqual>
       </td>
       <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL"><bean:message key="label.sales.salesOrder.DeliveryTerms" /> : </font></td>
       <td width="21%" class="bodytext"><nested:write name="salesOrderForm" property="deliveryTerms" />
        </td>
       <td width="3%">&nbsp;</td>

     </tr>
     <tr>
       <td width="21%" valign="top"><font class="NArialL">Billing Address :</font></td>
       <td width="21%" valign="top"><font class="bodytext">
       <%=approveOrderForm.getSalesOrder().getBillingAddressAsHTML()%> </font></td>
       <td width="3%">&nbsp;</td>
       <td width="21%" valign="top"><font class="NArialL">Shipping Address :</font></td>
       <td width="21%" valign="top"><font class="bodytext">
        <%=approveOrderForm.getSalesOrder().getShippingAddressAsHTML()%></font>
       </td>
       <td width="3%">&nbsp;</td>
     </tr>
     <tr><td colsapn=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
     <tr>
       <td width="21%"><font class="NArialL">Freight Instructions :</font></td>
       <td width="21%"><font class="bodytext"><nested:write property="freightInstructions" /></font></td>
       <td width="3%">&nbsp;</td>
       <td width="21%"><font class="NArialL">Shipping Instructions :</font></td>
       <td width="21%"><font class="bodytext"><nested:write property="shippingInstructions" /></font></td>
       <td width="3%">&nbsp;</td>
     </tr>
     <tr>
       <td width="21%"><font class="NArialL">Comments :</font></td>
       <td width="21%"><font class="bodytext"><nested:write property="comments" /></font></td>
       <td width="3%">&nbsp;</td>
       <td width="21%">&nbsp;</td>
       <td width="21%">&nbsp;</td>
       <td width="3%">&nbsp;</td>
     </tr>
        <%
            String commentsGroupId = "SalesOrder-" + approveOrderForm.getSalesOrderNo();
        %>
        <tr><td colspan=6><chiptrack:internalComments commentsGroupId="<%=commentsGroupId%>"/></td></tr>

     <tr>
       <td width="21%"></td>
       <td width="21%"></td>
       <td width="3%">&nbsp;</td>
       <td width="21%"></td>
       <td width="21%"></td>
       <td width="3%">&nbsp;</td>
     </tr>
     </nested:nest>
     <tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
     <tr><td colspan=6>
      <%if("TRUE".equalsIgnoreCase((String)request.getAttribute("showPreviousList") ) ){%>
      <table border="0" width="100%" bordercolor="#FFFFFF">
        <tr><td colspan='9' class="NArialL">Previous Order </td></tr>
	 <tr>
	   <td width="8%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Line Item</font></font></td>
	   <td width="15%" align="center" bgcolor="#993333"><font class="NArialL">
         <font color="#FFFFFF"><bean:message key="label.mfgPartNumber" arg0="Test" /></font></font>
	   </td>
           <td width="15%" align="center" bgcolor="#993333">
               <font class="NArialL"><font color="#FFFFFF"><bean:message key="label.customerPartNumber" arg0="Test" /></font></font>
            </td>
           <td width="10%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Req'd Dock Date</font></font></td>
           <td width="5%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Quantity</font></font></td>
	   <td width="10%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Price </font></font></td>
	   <td width="10%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Amount</font></font></td>
           <td width="10%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Status</font></font></td>
           <td width="10%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Change Number</font></font></td>
         </tr>
         <logic:iterate id="LineItem" name="previousLineItems" type="com.scalar.chiptrack.sales.LineItem">
         <tr>
	   <td width="8%" bgcolor="#DEE1E2">
                <font class="bodytext"><bean:write name="LineItem" property="lineItemNo" /></font></td>
	   <td width="15%" bgcolor="#DEE1E2">
                <font class="bodytext"><bean:write name="LineItem" property="manufacturingPartNo" /></font></td>
       <td width="15%" bgcolor="#DEE1E2">
                <font class="bodytext"><bean:write name="LineItem" property="customerPartNo" /></font></td>
	   <td width="10%" bgcolor="#DEE1E2">
                <font class="bodytext"><bean:write name="LineItem" property="requestDate" /></font></td>
           <td width="5%" bgcolor="#DEE1E2" align=right>
                <font class="bodytext"><bean:write name="LineItem" property="qtyAsString"/></font></td>
	   <td width="10%" bgcolor="#DEE1E2" align=right>
                <font class="bodytext"><bean:write name="LineItem" property="unitPriceAsString" /></font></td>
           <td width="10%" bgcolor="#DEE1E2" align=right>
                <font class="bodytext"><bean:write name="LineItem" property="amountAsString" /></font></td>
           <td width="10%" bgcolor="#DEE1E2">
                <font class="bodytext"><bean:write name="LineItem" property="status" /></font></td>
           <td width="10%" bgcolor="#DEE1E2" align=center>
                <font class="bodytext"><bean:write name="LineItem" property="changeNumber" /></font></td>
         </tr>
         </logic:iterate>
        </table>
        <%}%>
       <%-- </logic:equal>--%>
        </td>
     </tr>
     <tr><td colspan=6><chiptrack:info styleClass="NArialL" /></td></tr>
     <tr><td colspan=6><chiptrack:errors styleClass="NArialL" /></td></tr>
     <tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tr>
     <tr>
        <td colspan=2 class="NArialL">
            <% if((request.getParameter("isSample") != null) && (request.getParameter("isSample").equals("0"))) { %>
                    <chiptrack:restrictedLink functionality='<%=Functionality.SAMPLE_CHANGE_ORDER%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:splitLineItems();" onmouseover="window.status='Click here to split line items';return true" onmouseout="window.status='';return true">
             Split Line Items</chiptrack:restrictedLink>
            <% } else { %>
                   <chiptrack:restrictedLink functionality='<%=Functionality.SALES_CHANGE_ORDER%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:splitLineItems();" onmouseover="window.status='Click here to split line items';return true" onmouseout="window.status='';return true">
             Split Line Items</chiptrack:restrictedLink>
            <% } %>

        </td>
        <td colspan=2 class="NArialL">
            <A HREF="javascript:openAuditTrail();" onmouseover="window.status='Click for Audit Trail';return true" onmouseout="window.status='';return true" >Audit Trail</A></td>
        <td colspan=2 class="NArialL">
            <A href="javascript:openReasonCodes();"onmouseover="window.status='Click for Reason Codes';return true" onmouseout="window.status='';return true" >ReasonCodes Description</A></td>
     </tr>
    <tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=5></td></tr>
    <tr><td colspan='6' align="left" class='NArialL'><FONT id="errors" color='FF0000'></FONT><br></TD></tr>
     <tr><td colspan=6>
        <% int noOfColumnsBeforeQty =4; %>
        <table border="0" width="100%" bordercolor="#FFFFFF">
        <tr><td colspan='11' class="NArialL">Current Order </td></tr>
	 <tr>
        <td width="5%" align="center" bgcolor="#993333"><font class="NArialL">
            <font color="#FFFFFF">Line Item</font></font></td>
        <td width="10%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF"><bean:message key="label.mfgPartNumber" arg0="Test"/></font></font>
	    </td>
        <% if(ConfigManager.getBooleanProperty(ConfigManager.PROP_SHOW_SALES_LINEITEM_MARKETING_PART_NUMBER)) { %>
            <td width="10%" align="center" bgcolor="#993333"><font class="NArialL"><font color="#FFFFFF"><bean:message key="label.mktgPartNumber" /></font></td>
         <% noOfColumnsBeforeQty ++; } %>
        <td width="10%" align="center" bgcolor="#993333"><font class="NArialL">
            <font color="#FFFFFF">
			   <bean:message key="label.customerPartNumber" arg0="Test"/>
		    </font></font></td>
        <td width="1%" align=center bgcolor='#993333' class="NArialL">
            <font color="#FFFFFF">Taxable</font></td>
	   <td width="5%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Quantity</font></font></td>
	   <td width="8%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Price </font></font></td>
	   <td width="8%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Amount</font></font></td>
	  <td width="8%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Req'd Dock Date</font></font></td>
          <td width="8%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Sugg ShipDate</font></font></td>
           <td width="8%" align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Schedule Date<br><font size="-3">(mm/dd/yyyy)</font></font></font></td>

            <%-- added by Murali Krishna, 14 Feb 2005 --%>
           <td align="center" bgcolor="#993333"><font class="NArialL">
                <font color="#FFFFFF">Revised Ship Date</font></font></td>
           <%-- end: Murali Krishna --%>

           <td width="30%" bgcolor='#993333'>
            <table with="100%" border=0>
                <tr><td colspan=4 class="NArialL" align=center><font color="#FFFFFF">Holds</font></td></tr>
                <font size="-3"><tR><td width="25%" align=left class="NArialL"><font color="#FFFFFF">Mktg</font></td><td  width="25%" align=center class="NArialL"><font color="#FFFFFF">Fin</font></td><td width="25%" align=right class="NArialL"><font color="#FFFFFF">Ops</FONT></td><td  align=right width="25%" class="NArialL"><font color="#FFFFFF">&nbsp;&nbsp;&nbsp;Sales</FONT></td></tr></font>
            </table>
           </td>
         </tr>

         <jsp:include page="lineItemsForPendingSalesOrder.jsp" flush="true" />
         <tr>

         <%  int colSpan = noOfColumnsBeforeQty+2; %>

        <nested:nest property="salesOrder">
            <td  colspan=<%=colSpan%> class="NArialL" align="right">Total</td>
            <td bgcolor="#DEE1E2" class="NArialL" align="right"><nested:write property="subTotalAsString" /></td>
        </tr>
        <tr>
            <td colspan=<%=colSpan%> align=right class="NArialL">Sales Tax</td>
            <td bgcolor='#DEE1E2' class="NArialL" align="right"><nested:write property="salesTaxAsString" /></td>
        </tr>
        <tr>
            <td colspan=<%=colSpan%> align=right class="NArialL">Freight</td>
            <td bgcolor='#DEE1E2' class="NArialL" align="right"><nested:write property="frieghtAsString" /></td>
        </tr>
        <tr>
            <td colspan=<%=colSpan%> align=right class="NArialL">
                    <nested:write name="salesOrderForm" property="miscName"/>
                </td>
            <td bgcolor='#DEE1E2' class="NArialL" align="right"><nested:write property="miscAsString" /></td>
        </tr>
        <tr>
            <td colspan=<%=colSpan%> align=right class="NArialL">Order Total</td>
            <td bgcolor='#DEE1E2' class="NArialL" align="right"><nested:write property="orderTotalAsString" /></td>
        </tr>
        </nested:nest>
     </table>
     </td>
     </tr>
     <tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>

     <tr>
        <td colspan="6">
            <span class="NArialL">Approver Comments</span><BR>
            <html:textarea name="approverOrderForm" rows="4" cols="63" property="approverComments" styleClass="txfield" onkeydown="javascript:setTextAreaMaxLength(document.approverOrderForm.approverComments,300)" onkeyup="javascript:setTextAreaMaxLength(document.approverOrderForm.approverComments,300)"/>
        </td>
     </tr>
    <tr><td colspan=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
     <tr>
       <td colspan=6 align=center>
        <% if( ( request.getParameter("isSample") != null ) && ( request.getParameter("isSample").equals("0") ) ) { %>
            <chiptrack:restrictedLink functionality='<%=Functionality.SAMPLE_PENDING_ORDER%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage('APPROVE');" onmouseover="window.status='Click here to Approve Pending Order';return true" onmouseout="window.status='';return true">
            <img src="<%=chipTracContext%>/jsp/includes/images/submit.gif" border='0' title="Click here to Approve Pending Order"></chiptrack:restrictedLink>
        <% } else { %>
            <chiptrack:restrictedLink functionality='<%=Functionality.SALES_PENDING_ORDER%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:submitPage('APPROVE');" onmouseover="window.status='Click here to Approve Pending Order';return true" onmouseout="window.status='';return true">
            <img src="<%=chipTracContext%>/jsp/includes/images/submit.gif" border='0' title="Click here to Approve Pending Order"></chiptrack:restrictedLink>
        <% } %>

         <%
          if( request.getParameter("requestOrderSchedulingSearch") != null && request.getParameter("requestOrderSchedulingSearch").trim().equals("true"))
          {
         %>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

        <a href="<%=chipTracContext%>/scheduling.do" onmouseover="window.status='Click to Cancel Approval';return true" onmouseout="window.status='';return true" title="click here to Cancel Approval"><img src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" border='0'></a>
         <%}else{%>
         <a href="<%=chipTracContext%>/pendingOrders.do?isSample=<%= request.getParameter("isSample")%>" onmouseover="window.status='Click to Cancel Approval';return true" onmouseout="window.status='';return true" title="click here to Cancel Approval"><img src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" border='0'></a>
         <%}%>
       </td>
     </tr>

    </table>


<input type="hidden" name="action" value="">
<input type="hidden" name="salesOrderId" value="<%= approveOrderForm.getSalesOrderId() %>" />
<input type="hidden" name="salesOrderNo" value="<%= approveOrderForm.getSalesOrderNo() %>"/>
<input type="hidden" name="isSample" value="<%=request.getAttribute("isSample")%>">
<input type="hidden" name="requestOrderSchedulingSearch" value="<%=request.getAttribute("requestOrderSchedulingSearch")%>">
<input type="hidden" name="fromOrderScheduling" value="false"/>
</html:form>
</html:html>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<%-- Footer starts here  --%>
<%@ include file="/jsp/includes/footer.jsp" %>
<%-- footer end here  --%>
</BODY>
</HTML>
<% }catch(Exception e){ e.printStackTrace();}%>